package com.tourism.service.impl;

import com.tourism.dao.TicketDao;
import com.tourism.entity.Ticket;
import com.tourism.service.TicketService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description
 * @Author z
 * @Date 2021-04-28 23:41
 */
@Service
public class TicketServiceImpl implements TicketService {

    @Autowired
    private TicketDao ticketDao;
//增加门票
    @Override
    public boolean addTicket(Ticket ticket) {
        ticket.init();
        return ticketDao.addTicket(ticket);
    }
//修改门票
    @Override
    public boolean updateTicket(Ticket ticket) {
        return ticketDao.updateTicket(ticket);
    }
//查询门票
    @Override
    public List<Ticket> getAllTicket(String name, Long attractionId) {
        return ticketDao.getAllTicket(name, attractionId);
    }

    @Override
    public Ticket getTicketById(Long id) {
        return ticketDao.getTicketById(id);
    }
//根据ID删除门票信息
    @Override
    public Boolean deleteTicketById(Long id) {
        return ticketDao.deleteTicketById(id);
    }
}
